package org.jeecg.common.util.enums;

import com.google.common.collect.Lists;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.List;
import java.util.Objects;

/**
 * @author guoyh
 * @ClassName OrderStatusEnum
 * @Description
 * @since 2020/8/26 22:34
 **/
@Getter
@AllArgsConstructor
public enum  OrderStatusEnum {

    WAIT(0,"待接诊"),
    DOING(1,"进行中"),
    CONFIRM(2,"确认中"),
    SETTLE_ING(3,"结算中"),
    SETTLE(4,"已结算"),
    REFUND(5,"退款中"),
    CLOSE(6,"已关闭"),;

    private int code;

    private String desc;
    public static OrderStatusEnum getInstance(Integer code){
        return Arrays.stream(values()).filter(item -> Objects.equals(code,item.getCode())).findFirst().orElse(null);
    }

    public static List<Integer> getDoing(){
        return Lists.newArrayList(WAIT.code,DOING.code);
    }
}
